import request from '@/utils/request'

export function selectAll(params) {
  return request({
    url: window.CONFIG.workOrderRestIp + '/customField/selectAll?currentPage=' + params.currentPage + '&pageSize=' + params.pageSize,
    method: 'get'
  })
}

export function selectAllType() {
  return request({
    url: window.CONFIG.workOrderRestIp + '/customField/selectAllType',
    method: 'get'
  })
}
export function selectByNameAndType(params) {
  return request({
    url: window.CONFIG.workOrderRestIp + '/customField/selectByNameAndType',
    method: 'post',
    data: params
  })
}
export function selectContentById(id) {
  return request({
    url: window.CONFIG.workOrderRestIp + '/customField/selectContentById?id=' + id,
    method: 'get'
  })
}

export function createCustomfield(params) {
  return request({
    url: window.CONFIG.workOrderRestIp + '/customField/createCustomfield',
    method: 'post',
    data: params
  })
}

export function deleteCustom(id) {
  return request({
    url: window.CONFIG.workOrderRestIp + '/customField/delete?id=' + id,
    method: 'get'
  })
}

export function updateContent(params) {
  return request({
    url: window.CONFIG.workOrderRestIp + '/customField/updateContent',
    method: 'post',
    data: params
  })
}

export function updateUseStatus(params) {
  return request({
    url: window.CONFIG.workOrderRestIp + '/customField/updateUseStatus?id=' + params.id + '&userId=' + params.userId + '&useStatus=' + params.useStatus,
    method: 'get'
  })
}

export function selectAllOpen() {
  return request({
    url: window.CONFIG.workOrderRestIp + '/customField/selectAllOpen',
    method: 'get'
  })
}
export function getAllSelectFieldListById(id) {
  return request({
    url: window.CONFIG.workOrderRestIp + '/customField/getAllSelectFieldListById?id=' + id,
    method: 'get'
  })
}

// 获取自定义字段数据源
export function selectByCode(code) {
  return request({
    url: window.CONFIG.workOrderRestIp + '/customField/selectByCode?code=' + code,
    method: 'get'
  })
}
